 <link rel="stylesheet" href="<?=base_url(); ?>resources/upload/css/style.css">

<link rel="stylesheet" href="<?=base_url(); ?>resources/upload/css/jquery.fileupload.css">
<link rel="stylesheet" href="<?=base_url(); ?>resources/upload/css/jquery.fileupload-ui.css">
<noscript><link rel="stylesheet" href="<?=base_url(); ?>resources/upload/css/jquery.fileupload-noscript.css"></noscript>
<noscript><link rel="stylesheet" href="<?=base_url(); ?>resources/upload/css/jquery.fileupload-ui-noscript.css"></noscript>
 
 <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Profil de l'utilisateur
                        <small>Control panel</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="<?=site_url()?>"><i class="fa fa-dashboard"></i> Accueil</a></li>
                        <li >Utilisateur</li>
                        <li class="active">Profil</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                	<div class="row">
                		<div class="col-lg-4 col-md-6">                		
                			<div class="box box-primary">
                				<div class="box-header">
                					<h4 class="box-title">Avatar</h4>
                				</div>
                				<div class="box-body">
                					<div class="avatar text-center">
                				
					
						<form role="form" action="<?=site_url('profile/defaultThumb')?>" method="post" enctype="multipart/form-data" id="default">
						<input name="id" type="hidden" value="<?=$user->id?>">						
						</form>
                					<?php if($user->avatar){?>
                					<img class="img-circle " src="<?=base_url()?>uploads/avatar/thumbs/<?=$user->avatar?>" width="200">
                					<?php }else{?>
                					<img class="img-circle " src="<?=base_url()?>uploads/avatar/medium/avatar_default.png" width="200">
                					<?php }?>
                					</div>
                					<hr>
                		<form role="form" action="<?=site_url('profile/addThumb')?>" method="post" enctype="multipart/form-data" >
						<input name="id" type="hidden" value="<?=$user->id?>">
						<input type="file" name="userfile" size="20">
						<div class="pull-right">
						<button class="btn btn-default" type="button" onclick="$('#default').submit()"><i class="fa fa-undo"></i> par défault </button>
						<button class="btn btn-primary" type="submit"><i class="fa fa-arrow-circle-up"></i> insérer </button>
						</div>
						</form>
                					
                					<div class="clearfix"></div>
                				</div>
                			</div>                		
                		</div>
                		<div class="col-lg-4 col-md-6">                		
                			<div class="box box-primary">
                				<div class="box-header">
                					<h4 class="box-title">Profil</h4>
                				</div>
                				<div class="box-body">
                					<dl class="dl-horizontal">
                						<dt>Nom & Prénom:</dt>
                						<dd class="allowEdit"><a href="#" id="name"  data-type="text" data-pk="<?=$user->id?>" data-url="<?=site_url()?>profile/modification" data-title="nom & prénom"><?=$user->name?></a></dd>
                						<dt>Email:</dt>
                						<dd class="allowEdit"><a href="#" id="email"  data-type="text" data-pk="<?=$user->id?>" data-url="<?=site_url()?>profile/modification" data-title="email"><?=$user->email?></a></dd>
                						<dt>Téléphone:</dt>
                						<dd class="allowEdit"><a href="#" id="telephone"  data-type="text" data-pk="<?=$user->id?>" data-url="<?=site_url()?>users/modification" data-title="telephone"><?=$user->telephone?></a></dd>
                                    	<dt>Adresse:</dt>
                                    	<dd class="allowEdit"><a href="#" id="address"  data-type="text" data-pk="<?=$user->id?>" data-url="<?=site_url()?>users/modification" data-title="adresse"><?=$user->address?></a></dd>
                						<hr>
                						<dt>Statut:</dt>
                						<dd><?php if( $user->banned == 0 && $user->verification_code =='' ){?><span class="label label-success">activé</span><?php }elseif($user->banned == 0 && $u->verification_code !=''){?><span class="label label-warning">en attendant</span><?php }elseif ($user->banned == 1 ){?><span class="label label-danger">suspend</span><?php }?></dd>
                						<dt>Authorisation:</dt>                					
                						<dd><?php foreach ($this->aauth->get_user_groups($user->id) as $group):?>
                						<span class="label label-primary"><?=$group->name?></span> | 
                						<?php endforeach;?></dd>
                						<hr>
                						<dt>Dernière connexion:</dt>
                						<dd><?=$user->last_login?></dd>
                						<dt>Dernière Activité:</dt>
                						<dd><?=$user->last_activity?></dd>
                					</dl>
                					<div class="clearfix"></div>
                				</div>
                			</div>                		
                		</div>
                		<div class="col-lg-4 col-md-6">                		
                			<div class="box box-primary">
                				<div class="box-header">
                					<h4 class="box-title">Mode de passe</h4>
                				</div>
                				<div class="box-body">
                					<div class="password">
                						<?php if(isset($msg_success)){?>
                							<p class="alert alert-success"><?=$msg_success?></p>
                						<?php }elseif(isset($msg_fail)){?>
                							<p class="alert alert-danger"><?=$msg_fail?></p>
                						<?php }?>
                						<form actions="" role="form" method="post">
                							<div class="form-group">
                								<label>Mot de passe:</label>
                								<input type="password" class="form-control" name="password" value="">
                								<?php echo form_error('password'); ?>
                							</div>
                							<div class="form-group">
                								<label>Confirmation mot de passe:</label>
                								<?php echo form_error('passconf'); ?>
                								<input type="password" class="form-control" name="passconf" value="">
                							</div>
                						
                						
                					</div>
                					<hr>
                					<div class="btns pull-right">
                						<button type="submit" class="btn btn-primary"><i class="fa  fa-key"></i> Changer </button>              						
                					</div>
                					</form>
                					<div class="clearfix"></div>
                				</div>
                			</div>                		
                		</div>
                	
                	
                	
                	
                	</div>
                
                
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
        
        
          <script>
        
        	$(function(){
            		/* initilize x-editable on dd a */
        		    			
					$(' dd.allowEdit a').editable({
						mode:'inline',		
						emptytext:'- vide -',						
						success:function(response, newValue){
							if(response=='name' ){
								location.reload();
							}
						}
					})

            	});
        
        </script>
        


